Hello Forums, I have a question about skiplist , I want to save two values , in skiplist is put (skiplistname , key , value) , could I use both key and value later . my code is
Skip noList = create()
//......
put (noList,iRefNo,abs)
//...
int absNum
Object oEnd
Object oStart
for o in m do {
absNum = o."Absolute Number"
if (find (noList,absNum)) {
Object End = Object absNum
for absNum in noList do {
Object oStart = Object abs
}
}
}
oStart -> oEnd// create links
Regards, Neven Control17 - Thu Sep 07 04:30:26 EDT 2017 |
Re: Skiplist The skip-find has an additional third (optional) parameter to capture the found data: bool find(Skip s, type1 key [, type2 &data]) HTH |
Re: Skiplist thsturm - Thu Sep 07 08:29:59 EDT 2017 The skip-find has an additional third (optional) parameter to capture the found data: bool find(Skip s, type1 key [, type2 &data]) HTH Hello Thomas, thank u for your reply , do u know how can i get the third parameter for my code i get error in line 11 "incorrect arguments for function (print)"
Skip noList = create()
//......
put (noList,iRefNo,abs)
//...
int absNum
for o in m do {
absNum = o."Absolute Number"
if (find (noList,absNum,abs)) {
print absNum "\n"
print abs "\n"
}
}
for my code i want to find if the absNum in skiplist is and print it with abs
Regards, Neven
|
Re: Skiplist Control17 - Thu Sep 07 08:57:44 EDT 2017 Hello Thomas, thank u for your reply , do u know how can i get the third parameter for my code i get error in line 11 "incorrect arguments for function (print)"
Skip noList = create()
//......
put (noList,iRefNo,abs)
//...
int absNum
for o in m do {
absNum = o."Absolute Number"
if (find (noList,absNum,abs)) {
print absNum "\n"
print abs "\n"
}
}
for my code i want to find if the absNum in skiplist is and print it with abs
Regards, Neven
What type is 'abs'?
Please read the 'Skip list example program' in the DXL Reference Manual, chapter 6, General language facilities, Skip lists. |
Re: Skiplist thsturm - Thu Sep 07 09:19:27 EDT 2017 What type is 'abs'?
Please read the 'Skip list example program' in the DXL Reference Manual, chapter 6, General language facilities, Skip lists. abs is int |
Re: Skiplist Control17 - Thu Sep 07 09:23:54 EDT 2017 abs is int are you sure? Did you define "int abs" at the beginnng of your program? Otherwise I cannot understand the error you get. "incorrect arguments for function (print)" means that the argument to print is not a string. abs is integer, "\n" is string. integer variable concatenated with string gives a string variable, so there should not be a problem. |
Re: Skiplist Control17 - Thu Sep 07 09:23:54 EDT 2017 abs is int int abs = 42 print abs "\n" => 42
|
Re: Skiplist Mike.Scharnow - Thu Sep 07 17:06:11 EDT 2017 are you sure? Did you define "int abs" at the beginnng of your program? Otherwise I cannot understand the error you get. "incorrect arguments for function (print)" means that the argument to print is not a string. abs is integer, "\n" is string. integer variable concatenated with string gives a string variable, so there should not be a problem. Hello Mike , yes , I define abs als int this is the complete code
pragma runLim, 0
Module m = current
Object o = current
filtering off
Regexp Reference = regexp2 "\\[[I][t][_]+([0-9]+)\\]"
Skip numList = create()
for o in m do {
string theText = (o."Object Text" "") (o."Object Heading" "")
while (!null theText && Reference theText) {
string RefNum
RefNum = theText[match 1]
int abs = o."Absolute Number"
int iRefNum = intOf realOf RefNum
put (numList,iRefNum,abs)
}
theText = theText[end 1 +1:]
}
int absNum
for o in m do {
absNum = o."Absolute Number"
if (find (numList,absNum,abs)) {
print absNum "\n"
print abs "\n"
}
}
Regards, Neven
|
Re: Skiplist Control17 - Fri Sep 08 04:06:06 EDT 2017 Hello Mike , yes , I define abs als int this is the complete code
pragma runLim, 0
Module m = current
Object o = current
filtering off
Regexp Reference = regexp2 "\\[[I][t][_]+([0-9]+)\\]"
Skip numList = create()
for o in m do {
string theText = (o."Object Text" "") (o."Object Heading" "")
while (!null theText && Reference theText) {
string RefNum
RefNum = theText[match 1]
int abs = o."Absolute Number"
int iRefNum = intOf realOf RefNum
put (numList,iRefNum,abs)
}
theText = theText[end 1 +1:]
}
int absNum
for o in m do {
absNum = o."Absolute Number"
if (find (numList,absNum,abs)) {
print absNum "\n"
print abs "\n"
}
}
Regards, Neven
You defined "int abs" only inside your second block ({}), beginning with string refnum, ending with put(..). Outside this block, abs is not defined.
The first chapter of DXL Manual -> Language fundamentals, called "Auto-Declare", explains how you can disable the auto-declare functionality. If you do this, DOORS will warn you when you access undeclared variables.
About validity of variables, read DXL Manual -> Introduction -> Identifiers -> Scope |